<template>
  <footer>
    <ul>
      <!-- <li
        v-for="item in tabbarList"
        :key="item.title"
        :class="{ active: active === item.title }"
        @click="tab(item)"
      >
        <span class="iconfont" :class="'icon-' + item.icon"></span>
        <span>{{ item.title }}</span>
      </li> -->
      <router-link
        v-for="item in tabbarList"
        :key="item.title"
        :to="'/home' + item.url"
        tag="li"
      >
        <span class="iconfont" :class="'icon-' + item.icon"></span>
        <span>{{ item.title }}</span></router-link
      >
    </ul>
  </footer>
</template>

<script>
export default {
  data() {
    return {
      tabbarList: [
        {
          title: "电影/影院",
          icon: "dianying",
          url: "/movies",
        },
        {
          title: "视频",
          icon: "shipin",
          url: "/video",
        },
        {
          title: "小视频",
          icon: "xiaoshipinyingshi48",
          url: "/mini",
        },
        {
          title: "演出",
          icon: "yanchu-xianxing2-0",
          url: "/show",
        },
        {
          title: "我的",
          icon: "wode",
          url: "/mine",
        },
      ],
      // active: sessionStorage.getItem("active") || "电影/影院",
    };
  },
  // watch: {
  //   $route() {
  //     // 监听url，tabbarList里面去做匹配
  //   },
  // },
  methods: {
    // tab(item) {
    //   // 该高亮
    //   this.active = item.title;
    //   // 将active存到本地存储
    //   sessionStorage.setItem("active", this.active);
    //   // 跳转
    //   this.$router.push("/home" + item.url);
    // },
  },
};
</script>

<style lang="less" scoped>
@import "../../assets/css/var.less";
footer {
  width: 100%;
  height: 50px;
  background: #fff;
  position: fixed;
  left: 0;
  bottom: 0;
  font-size: @xs-font;

  ul {
    display: flex;
    height: 100%;

    li {
      flex: 1;
      .center();
      display: flex;
      flex-direction: column;

      .iconfont {
        font-size: @xl-font;
      }
    }

    .router-link-active {
      color: @theme-color;
    }
  }
}
</style>
